<%@ page language="java" pageEncoding="UTF-8"%>
<%@ page import="java.util.*"  %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<%@ include file="/pub/head_bootstrap.inc"%>
    <title>${basePageTitle}</title>
</head>

<body class="FrameRightBg">
	<div class="FrameRight" id="FrameRightContent">
		<div class="FrameRightInner mlzjhzdlb-default">
			<!-- location -->
			<div class="main">
				<div id="standardSearchForm">
					<%@ include file="/WEB-INF/jsp/module/view/new_selector_form.jsp"%>
					<form id="formsearch" method="post">
						<div class="selector-form"></div>
					</form>
				</div>
				<div class="common-table">
					<table id="main_tb" class="table table-hover"></table>
				</div>
			</div>
			<!-- main end -->
		</div>
		<!-- FrameRightInner -->
	</div>
	<!-- FrameRight -->
 	<script type="text/javascript">
 	// 渲染选择器
	var searchGrid = {
		$element: $('#main_tb'),
		load: function(){
			this.$element.bootstrapTable('refresh');
		}
	}
 	var busi = JSON.parse('${busi}'||'[]');
 	var selector = $.initSelector(searchGrid, [ 
           	        		    {id:"genDate",name:"到达时间",valueText:"全部",isExtended:false,selectType:5,
        	        		    	formate:"yyyy-MM-dd",startDay:null,endDay:null,type:0,measurement:null},
        	        		    {id:"busiType",name:"待办类型",value:null,valueText:"全部",isExtended:false,selectType:0},
        	        		    {id:"title",name:"标题",value:"",isExtended:false,selectType:1}], null, [{id:"busiType",name:"待办类型",data:busi}]);
 	
 	var tableHeight = parseInt($("body").height()) - 230 ;
	var pageSize = parseInt(tableHeight/35);
	if(pageSize<0){
		pageSize=10;
	}
	
  	DirectoryCollectMake = {
		initTable: function(){
			$('#main_tb').bootstrapTable({
	       		url: '${baseURL}/process/gtasks/worklist/listUndoByUser.do',
	       		sidePagination: "server",
	       		dataType:'json',
	       		dataField: 'Rows',
	       		totalField: 'Total',
	       		contentType:'application/x-www-form-urlencoded',
	       		queryParamsType:"undefined",
	       		queryParams: function(params){
	       			var data = [];
					if(selector != null){
						data = selector.getSelectorValue();
					}
	       	        return {
	    				pageNo: params.pageNumber,
	    				perPageSize: params.pageSize,
	    				sortname : params.sortName,
	    				sortorder : params.sortOrder,
	    				searchParam: JSON.stringify(data)
	    			}
	       	    },
	            striped: true,                      //是否显示行间隔色
	            pagination: true,					//是否显示分页信息
	            pageNumber:1,                       //初始化加载第一页，默认第一页
                pageSize: pageSize,                       //每页的记录行数（*）
                pageList: [10, 20, 50],        //可供选择的每页的行数（*）
    	        clickToSelect: true,                //是否启用点击选中行
	            uniqueId: "id",                 //每一行的唯一标识，一般为主键列
	            onDblClickRow: onDblClickRow,		//双击事件
	       		columns: [{
                   field: 'number',
                   title: '序号',
   	               formatter: function (value, row, index) {
   	                   return (index+1);  
   	              }
               }, {
                   field: 'title',
                   title: '标题',
                   formatter:function(value,row){
						return '<a href="${baseURL}/process/gtasks/works/undo.do?worklistItemId='+row.id+'&'+Math.random()+'" target="_blank">'+value+'</a>'
                    } 
               }, {
                   field: 'nodeName',
                   title: '当前状态',
               }, {
                   field: 'createDate',
                   title: '到达时间',
               }]
			})
		}, 
		main: function(){
			var _this = DirectoryCollectMake;
			_this.initTable();
		}
	}
	$(function () {
		DirectoryCollectMake.main();
	});
  </script>
  <script type="text/javascript">
  	function onDblClickRow (row) {
		WinPrint2("${baseURL}/process/gtasks/works/undo.do?worklistItemId="+row.id+"&"+Math.random());
	};
  </script>
</body>
</html>
